﻿using Microsoft.AspNetCore.Mvc;
using sm2_sm3_sm4.Models;
using sm2_sm3_sm4.Utils;
using System.Diagnostics;

namespace sm2_sm3_sm4.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }

        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }
            string pubKey = "04529854dd2b23e0c8358abdf6d12bdfeaacdc6dfd37389b87a3cd2fd44cbc21f0bb31964c045fcd3bc93e8a99c5f29312d7a902a625e90a3adc466f9b1507123b";
            string priKey = "42ebe0a41a0a65b702d1515e666f20b7437683d92e3e03f6482aaacbe220ebaa";
        public IActionResult sm2()
        {
            var tt = SM2Util.encryptBase64("www.ruovea.com", pubKey);

            var tty = SM2Util.decryptBase64("www.ruovea.com", "35b99704d5b9efac7ac3592883e8aa9f3ca4c576f570bed1d15b16f98b096e537234d4908c4014001d021600d660544699165489cd46ca03c1765dccdd5980f0c8ca533fce10e9ae8bbb2be2f9a2696d2efb0ca8e9ba5c7e8c8584666ac22e514fb6a28217ad0836a42cadf95b4f");

            sm2_sm3_sm4.util2.SM2Utils
            ViewBag.pubKey = pubKey;
            ViewBag.priKey = priKey;
            ViewBag.rus = tt;
            return View();
        }

        public IActionResult sm3()
        {
            return View();
        }

        public IActionResult sm4()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}